Enter the directory of the maca folder on your drive and the name of the tissue you want to analyze.
tissue_of_interest = "Kidney"
library(here)
source(here("00_data_ingest", "02_tissue_analysis_rmd", "boilerplate.R"))
tiss = load_tissue_facs(tissue_of_interest)
Performing log-normalization
0% 10 20 30 40 50 60 70 80 90 100%
[----|----|----|----|----|----|----|----|----|----|
**************************************************|
[1] "Scaling data matrix"
|
| | 0%
|
|===========================================================================================================================| 100%
Calculating gene means
0% 10 20 30 40 50 60 70 80 90 100%
[----|----|----|----|----|----|----|----|----|----|
**************************************************|
Calculating gene variance to mean ratios
0% 10 20 30 40 50 60 70 80 90 100%
[----|----|----|----|----|----|----|----|----|----|
**************************************************|
Visualize top genes in principal components
Later on (in FindClusters and TSNE) you will pick a number of principal components to use. This has the effect of keeping the major directions of variation in the data and, ideally, supressing noise. There is no correct answer to the number to use, but a decent rule of thumb is to go until the plot plateaus.
PCElbowPlot(object = tiss)
Choose the number of principal components to use.
# Set number of principal components.
n.pcs = 7
The clustering is performed based on a nearest neighbors graph. Cells that have similar expression will be joined together. The Louvain algorithm looks for groups of cells with high modularity–more connections within the group than between groups. The resolution parameter determines the scale…higher resolution will give more clusters, lower resolution will give fewer.
For the top-level clustering, aim to under-cluster instead of over-cluster. It will be easy to subset groups and further analyze them below.
# Set resolution
res.used <- 2.5
tiss <- FindClusters(object = tiss, reduction.type = "pca", dims.use = 1:n.pcs,
resolution = res.used, print.output = 0, save.SNN = TRUE)
To visualize
# If cells are too spread out, you can raise the perplexity. If you have few cells, try a lower perplexity (but never less than 10).
tiss <- RunTSNE(object = tiss, dims.use = 1:n.pcs, seed.use = 10, perplexity=30)
# note that you can set do.label=T to help label individual clusters
TSNEPlot(object = tiss, do.label = T)
Compare to previous annotations
filename = here('00_data_ingest', '03_tissue_annotation_csv',
paste0(tissue_of_interest, "_facs_annotation.csv"))
previous_annotation = read_csv(filename)
Missing column names filled in: 'X1' [1]Parsed with column specification:
cols(
X1 = col_character(),
plate.barcode = col_character(),
cell_ontology_class = col_character(),
cell_ontology_id = col_character(),
free_annotation = col_character(),
tSNE_1 = col_double(),
tSNE_2 = col_double()
)
tiss@meta.data[, "previous_annotation"] <- "NA"
tiss@meta.data[as.character(previous_annotation$X1), 'previous_annotation'] <- as.character(previous_annotation$cell_ontology_class)
TSNEPlot(object = tiss, do.return = TRUE, group.by = "previous_annotation")
table(as.character(tiss@meta.data[, "previous_annotation"]))
endothelial cell epithelial cell of proximal tubule
126 117
kidney collecting duct intercalated cell kidney collecting duct principal cell
65 58
kidney proximal straight tubule epithelial cell macrophage
98 39
NA natural killer cell
2 14
table(tiss@meta.data[, "previous_annotation"], tiss@ident)
0 1 2 3 4 5 6 7 8
endothelial cell 0 72 0 0 1 53 0 0 0
epithelial cell of proximal tubule 0 0 55 5 0 0 50 7 0
kidney collecting duct intercalated cell 65 0 0 0 0 0 0 0 0
kidney collecting duct principal cell 15 0 0 0 0 0 0 0 43
kidney proximal straight tubule epithelial cell 0 0 6 52 0 0 0 40 0
macrophage 0 0 0 0 39 0 0 0 0
NA 0 0 0 0 1 0 1 0 0
natural killer cell 0 0 0 0 14 0 0 0 0
Check expression of genes of interset.
Dotplots let you see the intensity of exppression and the fraction of cells expressing for each of your genes of interest.
How big are the clusters?
table(tiss@ident)
0 1 2 3 4 5 6 7 8
80 72 61 57 55 53 51 47 43
At a coarse level, we can use canonical markers to match the unbiased clustering to known cell types:
tiss <- StashIdent(object = tiss, save.name = "cluster.ids")
cluster.ids <- c(0, 1, 2, 3, 4, 5, 6, 7, 8, 9)
cell_ontology_class <- c(
"endothelial cell",
'kidney collecting duct intercalated cell',
'epithelial cell of proximal tubule',
"kidney collecting duct principal cell",
"epithelial cell of proximal tubule",
'endothelial cell',
"kidney proximal straight tubule epithelial cell",
"kidney proximal straight tubule epithelial cell",
"macrophage",
"natural killer cell")
free_annotation <- c(NA, NA, NA, NA, NA, NA, NA, NA, NA, NA)
tiss = stash_annotations(tiss, cluster.ids, free_annotation, cell_ontology_class)
The following `from` values were not present in `x`: 9
The following `from` values were not present in `x`: 9
The following `from` values were not present in `x`: 9
TSNEPlot(tiss, group.by='cell_ontology_class', do.return=TRUE)
Error in reduction.type %in% names(object@dr) :
trying to get slot "dr" from an object of a basic class ("character") with no slots
Color by metadata, like plate barcode, to check for batch effects.
TSNEPlot(object = tiss, do.return = TRUE, group.by = "plate.barcode")
Print a table showing the count of cells in each identity category from each plate.
table(as.character(tiss@ident), as.character(tiss@meta.data$plate.barcode))
B001717 B002775 MAA000545 MAA000752 MAA000801 MAA000922
0 5 11 16 7 23 9
1 20 17 1 3 21 3
2 10 7 12 6 20 5
3 5 8 9 14 18 4
4 3 3 13 15 18 5
5 40 7 3 2 1 2
6 23 5 1 4 18 2
7 3 8 11 6 10 7
8 8 2 1 8 17 3
9 6 3 2 0 3 0
We can repeat the above analysis on a subset of cells, defined using cluster IDs or some other metadata. This is a good way to drill down and find substructure.
# Subset data based on cluster id
subtiss <- SubsetData(object = tiss, ident.use = c(6,4,9,2), do.center = F, do.scale = F, cells.use = )
# To subset data based on cell_ontology_class or other metadata, you can explicitly pass cell names
# anno = 'exocrine cells'
# cells.to.use = tiss@cell.names[which(tiss@meta.data$cell_ontology_class == anno)]
# subtiss <- SubsetData(object = tiss, cells.use = cells.to.use, do.center = F, do.scale = F)
subtiss <- NormalizeData(object = subtiss)
Performing log-normalization
0% 10 20 30 40 50 60 70 80 90 100%
[----|----|----|----|----|----|----|----|----|----|
**************************************************|
subtiss <- ScaleData(object = subtiss, vars.to.regress = c("nReads", "percent.ribo","Rn45s"))
[1] "Regressing out nReads" "Regressing out percent.ribo" "Regressing out Rn45s"
|
| | 0%
|
|= | 1%
|
|== | 1%
|
|=== | 2%
|
|==== | 3%
|
|===== | 4%
|
|====== | 5%
|
|======= | 6%
|
|======== | 7%
|
|========= | 7%
|
|========== | 8%
|
|=========== | 9%
|
|============ | 10%
|
|============= | 10%
|
|============== | 11%
|
|============== | 12%
|
|=============== | 12%
|
|================ | 13%
|
|================= | 14%
|
|================== | 15%
|
|=================== | 15%
|
|==================== | 16%
|
|===================== | 17%
|
|====================== | 18%
|
|======================= | 18%
|
|======================== | 19%
|
|======================== | 20%
|
|========================= | 21%
|
|========================== | 21%
|
|=========================== | 22%
|
|============================ | 23%
|
|============================= | 24%
|
|============================== | 24%
|
|=============================== | 25%
|
|================================ | 26%
|
|================================= | 26%
|
|================================= | 27%
|
|================================== | 28%
|
|=================================== | 29%
|
|==================================== | 29%
|
|===================================== | 30%
|
|====================================== | 31%
|
|======================================= | 32%
|
|======================================== | 32%
|
|========================================= | 33%
|
|========================================== | 34%
|
|=========================================== | 35%
|
|============================================ | 36%
|
|============================================= | 37%
|
|============================================== | 38%
|
|=============================================== | 38%
|
|================================================ | 39%
|
|================================================= | 40%
|
|================================================== | 40%
|
|=================================================== | 41%
|
|==================================================== | 42%
|
|==================================================== | 43%
|
|===================================================== | 43%
|
|====================================================== | 44%
|
|======================================================= | 45%
|
|======================================================== | 46%
|
|========================================================= | 46%
|
|========================================================== | 47%
|
|=========================================================== | 48%
|
|============================================================ | 49%
|
|============================================================= | 49%
|
|============================================================== | 50%
|
|============================================================== | 51%
|
|=============================================================== | 51%
|
|================================================================ | 52%
|
|================================================================= | 53%
|
|================================================================== | 54%
|
|=================================================================== | 54%
|
|==================================================================== | 55%
|
|===================================================================== | 56%
|
|====================================================================== | 57%
|
|======================================================================= | 57%
|
|======================================================================= | 58%
|
|======================================================================== | 59%
|
|========================================================================= | 60%
|
|========================================================================== | 60%
|
|=========================================================================== | 61%
|
|============================================================================ | 62%
|
|============================================================================= | 62%
|
|============================================================================== | 63%
|
|=============================================================================== | 64%
|
|================================================================================ | 65%
|
|================================================================================= | 66%
|
|================================================================================== | 67%
|
|=================================================================================== | 68%
|
|==================================================================================== | 68%
|
|===================================================================================== | 69%
|
|====================================================================================== | 70%
|
|======================================================================================= | 71%
|
|======================================================================================== | 71%
|
|========================================================================================= | 72%
|
|========================================================================================== | 73%
|
|========================================================================================== | 74%
|
|=========================================================================================== | 74%
|
|============================================================================================ | 75%
|
|============================================================================================= | 76%
|
|============================================================================================== | 76%
|
|=============================================================================================== | 77%
|
|================================================================================================ | 78%
|
|================================================================================================= | 79%
|
|================================================================================================== | 79%
|
|=================================================================================================== | 80%
|
|=================================================================================================== | 81%
|
|==================================================================================================== | 82%
|
|===================================================================================================== | 82%
|
|====================================================================================================== | 83%
|
|======================================================================================================= | 84%
|
|======================================================================================================== | 85%
|
|========================================================================================================= | 85%
|
|========================================================================================================== | 86%
|
|=========================================================================================================== | 87%
|
|============================================================================================================ | 88%
|
|============================================================================================================= | 88%
|
|============================================================================================================= | 89%
|
|============================================================================================================== | 90%
|
|=============================================================================================================== | 90%
|
|================================================================================================================ | 91%
|
|================================================================================================================= | 92%
|
|================================================================================================================== | 93%
|
|=================================================================================================================== | 93%
|
|==================================================================================================================== | 94%
|
|===================================================================================================================== | 95%
|
|====================================================================================================================== | 96%
|
|======================================================================================================================= | 97%
|
|======================================================================================================================== | 98%
|
|========================================================================================================================= | 99%
|
|========================================================================================================================== | 99%
|
|===========================================================================================================================| 100%
[1] "Scaling data matrix"
|
| | 0%
|
|===========================================================================================================================| 100%
subtiss <- FindVariableGenes(object = subtiss, do.plot = TRUE, x.high.cutoff = Inf, y.cutoff = 0.8)
Calculating gene means
0% 10 20 30 40 50 60 70 80 90 100%
[----|----|----|----|----|----|----|----|----|----|
**************************************************|
Calculating gene variance to mean ratios
0% 10 20 30 40 50 60 70 80 90 100%
[----|----|----|----|----|----|----|----|----|----|
**************************************************|
subtiss <- RunPCA(object = subtiss, pcs.compute = 20)
[1] "PC1"
[1] "Tcf7" "Frat1" "Pik3ip1" "Gatm" "Ankrd24" "Zfand2a" "Il7r" "Adcy3"
[9] "Cd63" "4632428N05Rik" "Inpp1" "Zfc3h1" "Tnrc6a" "Oxct1" "Yipf2" "Ermp1"
[17] "Dnajc18" "Spp1" "Hao2" "Eid1" "Msl3" "Slc5a3" "Fam49a" "Cep97"
[25] "L3mbtl3" "Gm6225" "Pms1" "Ankrd16" "Fam160b1" "Gnl3"
[1] ""
[1] "Nkg7" "AW112010" "Anxa2" "Arhgdib" "Selplg" "Tmsb4x" "Il2rb" "Coro1a" "B4galnt1" "H2-Q6" "Psmb8"
[12] "Sla" "Gata3" "Esyt1" "Hmha1" "Rac2" "Gem" "Itgb2" "Ccl5" "Anxa6" "Ifngr1" "Gimap3"
[23] "Laptm5" "Cd48" "Fgl2" "Cd7" "Vim" "Fxyd5" "Tspan32" "Lsp1"
[1] ""
[1] ""
[1] "PC2"
[1] "Cd79a" "Cd79b" "Cd74" "Ly6d" "Ms4a1" "H2-Aa" "Prkcb" "H2-Eb1" "Cnp" "Hvcn1" "Ltb" "Faim3"
[13] "H2-Ab1" "Fli1" "Cd72" "Spib" "H2-DMb2" "Cd69" "Ccr7" "Mef2c" "Cd22" "Filip1l" "Ebf1" "Lrmp"
[25] "Cd83" "Dok3" "Pik3c2b" "Rnase6" "Vpreb3" "H2-Ob"
[1] ""
[1] "Ccnd2" "Fxyd5" "Lat" "Vps37b" "Cd28" "Itgb7" "Lck" "Tnfaip3"
[9] "Cd3g" "Lcp2" "Cd3d" "Vav1" "Frat1" "Tcf7" "Ms4a4b" "AW112010"
[17] "A630001G21Rik" "Emb" "Cd8b1" "Zap70" "Itgb2" "Ms4a6b" "Bcl2" "Nkg7"
[25] "Ctsw" "Ccl5" "Ctsc" "Anxa2" "Gimap3" "S1pr1"
[1] ""
[1] ""
[1] "PC3"
[1] "Unc93b1" "Crip1" "Gramd3" "Pim2" "Ralgps2" "Tmem39b" "Atic" "Tgif1"
[9] "Kdm6b" "Hsf2" "Papd4" "Lat2" "Btbd7" "Fcrl1" "Fen1" "Spib"
[17] "Socs5" "Utp18" "Scmh1" "Zbtb2" "Zfp296" "Ankrd37" "1110031I02Rik" "Dffb"
[25] "Rasgrp1" "Adck2" "Ccnj" "Usp42" "Zc3h10" "B4galt7"
[1] ""
[1] "Grap" "Rhof" "Elmo1" "Rhoh" "Lpar6" "H2-T24" "Faim3" "Sept6"
[9] "Cd83" "Tmem209" "H2-DMa" "Rfc4" "Ly9" "Sell" "Gimap7" "Ep300"
[17] "Shisa5" "Hltf" "Slain1" "Rftn1" "Akna" "Ppp1r12c" "Mical1" "Mif4gd"
[25] "Ucp2" "Zfp263" "A830007P12Rik" "Asb6" "Mapkapk3" "Pcif1"
[1] ""
[1] ""
[1] "PC4"
[1] "Sell" "Cxcr5" "Ctss" "Slfn2" "Fcer2a" "Blk" "Ep300" "Cmtm7" "Mef2c" "Gimap7"
[11] "Serpinb1a" "H2-Ob" "Ly9" "Prkd2" "Tmem209" "Rnf20" "Cd69" "Gm14446" "Cd55" "Eral1"
[21] "Akna" "Cd72" "Thap11" "Fam53b" "Myst3" "Dok3" "Nrm" "Pml" "Usp25" "Bank1"
[1] ""
[1] "Ptpn4" "2810013P06Rik" "Gpr171" "Pcif1" "Rcsd1" "Arid4b" "Hltf" "Gm6225"
[9] "Rgs19" "Asb6" "A830007P12Rik" "Filip1l" "Rasal3" "Nipsnap3b" "R3hcc1" "Zfp263"
[17] "Cybb" "Gstm4" "Rftn1" "Ppp1r12c" "Rassf4" "Btbd10" "Rab3gap1" "Abcg1"
[25] "Pcnt" "Pik3c2b" "Pms1" "Ngdn" "Klre1" "Serpinb6b"
[1] ""
[1] ""
[1] "PC5"
[1] "Fcho1" "Cd5" "Tacc1" "Cd247" "Pwwp2a" "Smc4" "Nufip2" "Orc3" "Rapgef6"
[10] "Zc3h12d" "Esyt1" "Klhdc4" "Wars2" "Rc3h1" "Tab3" "Tmem161a" "Galnt6" "Ube2g2"
[19] "Mical1" "Cdkn2aipnl" "Zfp954" "Ddx10" "Mapkapk3" "Rab28" "Ccr2" "Rhof" "Cd4"
[28] "Prpf3" "Faf1" "Bzw2"
[1] ""
[1] "Pkm2" "P2ry10" "Arhgap30" "Lcp2" "Zap70" "Xpo1" "Cd8b1" "Lck" "Trim30a" "Wdr3"
[11] "Lrrfip1" "Ms4a4b" "Ier5" "Smek1" "Plekha5" "Nrm" "Mef2c" "Sh3kbp1" "Cxcr5" "Serpina3g"
[21] "Fcer2a" "Stat1" "Serpinb1a" "Casp8ap2" "Mad2l1bp" "Fyn" "Esco1" "Ctsw" "Slc35e1" "Trp53inp1"
[1] ""
[1] ""
subtiss <- ProjectPCA(object = subtiss, do.print = FALSE)
Run Principal Component Analysis.
subtiss <- RunPCA(object = subtiss, do.print = FALSE)
subtiss <- ProjectPCA(object = subtiss, do.print = FALSE)
# If this fails for your subset, it may be that cells.use is more cells than you have left! Try reducing it.
PCHeatmap(object = subtiss, pc.use = 1:3, cells.use = 290, do.balanced = TRUE, label.columns = FALSE, num.genes = 3)
Later on (in FindClusters and TSNE) you will pick a number of principal components to use. This has the effect of keeping the major directions of variation in the data and, ideally, supressing noise. There is no correct answer to the number to use, but a decent rule of thumb is to go until the plot plateaus.
PCElbowPlot(object = subtiss)
Choose the number of principal components to use.
# Set number of principal components.
sub.n.pcs = 10
The clustering is performed based on a nearest neighbors graph. Cells that have similar expression will be joined together. The Louvain algorithm looks for groups of cells with high modularity–more connections within the group than between groups. The resolution parameter determines the scale…higher resolution will give more clusters, lower resolution will give fewer.
# Set resolution
sub.res.used <- 1
subtiss <- FindClusters(object = subtiss, reduction.type = "pca", dims.use = 1:sub.n.pcs,
resolution = sub.res.used, print.output = 0, save.SNN = TRUE)
To visualize
# If cells are too spread out, you can raise the perplexity. If you have few cells, try a lower perplexity (but never less than 10).
subtiss <- RunTSNE(object = subtiss, dims.use = 1:sub.n.pcs, seed.use = 10, perplexity=10)
# note that you can set do.label=T to help label individual clusters
TSNEPlot(object = subtiss, do.label = T)
subtiss.markers <- FindAllMarkers(object = subtiss, only.pos = TRUE, min.pct = 0.25, thresh.use = 0.25)
| | 0 % ~calculating
|+ | 1 % ~05s
|++ | 2 % ~04s
|++ | 3 % ~04s
|+++ | 4 % ~04s
|+++ | 5 % ~04s
|++++ | 6 % ~04s
|++++ | 8 % ~04s
|+++++ | 9 % ~04s
|+++++ | 10% ~04s
|++++++ | 11% ~04s
|++++++ | 12% ~04s
|+++++++ | 13% ~04s
|+++++++ | 14% ~04s
|++++++++ | 15% ~04s
|+++++++++ | 16% ~03s
|+++++++++ | 17% ~03s
|++++++++++ | 18% ~03s
|++++++++++ | 19% ~03s
|+++++++++++ | 20% ~03s
|+++++++++++ | 22% ~03s
|++++++++++++ | 23% ~03s
|++++++++++++ | 24% ~03s
|+++++++++++++ | 25% ~03s
|+++++++++++++ | 26% ~03s
|++++++++++++++ | 27% ~03s
|++++++++++++++ | 28% ~03s
|+++++++++++++++ | 29% ~03s
|++++++++++++++++ | 30% ~03s
|++++++++++++++++ | 31% ~03s
|+++++++++++++++++ | 32% ~03s
|+++++++++++++++++ | 33% ~03s
|++++++++++++++++++ | 34% ~03s
|++++++++++++++++++ | 35% ~03s
|+++++++++++++++++++ | 37% ~03s
|+++++++++++++++++++ | 38% ~03s
|++++++++++++++++++++ | 39% ~03s
|++++++++++++++++++++ | 40% ~03s
|+++++++++++++++++++++ | 41% ~03s
|+++++++++++++++++++++ | 42% ~02s
|++++++++++++++++++++++ | 43% ~02s
|+++++++++++++++++++++++ | 44% ~02s
|+++++++++++++++++++++++ | 45% ~02s
|++++++++++++++++++++++++ | 46% ~02s
|++++++++++++++++++++++++ | 47% ~02s
|+++++++++++++++++++++++++ | 48% ~02s
|+++++++++++++++++++++++++ | 49% ~02s
|++++++++++++++++++++++++++ | 51% ~02s
|++++++++++++++++++++++++++ | 52% ~02s
|+++++++++++++++++++++++++++ | 53% ~02s
|+++++++++++++++++++++++++++ | 54% ~02s
|++++++++++++++++++++++++++++ | 55% ~02s
|++++++++++++++++++++++++++++ | 56% ~02s
|+++++++++++++++++++++++++++++ | 57% ~02s
|++++++++++++++++++++++++++++++ | 58% ~02s
|++++++++++++++++++++++++++++++ | 59% ~02s
|+++++++++++++++++++++++++++++++ | 60% ~02s
|+++++++++++++++++++++++++++++++ | 61% ~02s
|++++++++++++++++++++++++++++++++ | 62% ~02s
|++++++++++++++++++++++++++++++++ | 63% ~02s
|+++++++++++++++++++++++++++++++++ | 65% ~01s
|+++++++++++++++++++++++++++++++++ | 66% ~01s
|++++++++++++++++++++++++++++++++++ | 67% ~01s
|++++++++++++++++++++++++++++++++++ | 68% ~01s
|+++++++++++++++++++++++++++++++++++ | 69% ~01s
|+++++++++++++++++++++++++++++++++++ | 70% ~01s
|++++++++++++++++++++++++++++++++++++ | 71% ~01s
|+++++++++++++++++++++++++++++++++++++ | 72% ~01s
|+++++++++++++++++++++++++++++++++++++ | 73% ~01s
|++++++++++++++++++++++++++++++++++++++ | 74% ~01s
|++++++++++++++++++++++++++++++++++++++ | 75% ~01s
|+++++++++++++++++++++++++++++++++++++++ | 76% ~01s
|+++++++++++++++++++++++++++++++++++++++ | 77% ~01s
|++++++++++++++++++++++++++++++++++++++++ | 78% ~01s
|++++++++++++++++++++++++++++++++++++++++ | 80% ~01s
|+++++++++++++++++++++++++++++++++++++++++ | 81% ~01s
|+++++++++++++++++++++++++++++++++++++++++ | 82% ~01s
|++++++++++++++++++++++++++++++++++++++++++ | 83% ~01s
|++++++++++++++++++++++++++++++++++++++++++ | 84% ~01s
|+++++++++++++++++++++++++++++++++++++++++++ | 85% ~01s
|++++++++++++++++++++++++++++++++++++++++++++ | 86% ~01s
|++++++++++++++++++++++++++++++++++++++++++++ | 87% ~01s
|+++++++++++++++++++++++++++++++++++++++++++++ | 88% ~00s
|+++++++++++++++++++++++++++++++++++++++++++++ | 89% ~00s
|++++++++++++++++++++++++++++++++++++++++++++++ | 90% ~00s
|++++++++++++++++++++++++++++++++++++++++++++++ | 91% ~00s
|+++++++++++++++++++++++++++++++++++++++++++++++ | 92% ~00s
|+++++++++++++++++++++++++++++++++++++++++++++++ | 94% ~00s
|++++++++++++++++++++++++++++++++++++++++++++++++ | 95% ~00s
|++++++++++++++++++++++++++++++++++++++++++++++++ | 96% ~00s
|+++++++++++++++++++++++++++++++++++++++++++++++++ | 97% ~00s
|+++++++++++++++++++++++++++++++++++++++++++++++++ | 98% ~00s
|++++++++++++++++++++++++++++++++++++++++++++++++++| 99% ~00s
|++++++++++++++++++++++++++++++++++++++++++++++++++| 100% elapsed = 04s
| | 0 % ~calculating
|+ | 1 % ~08s
|++ | 2 % ~07s
|++ | 3 % ~07s
|+++ | 4 % ~07s
|+++ | 5 % ~07s
|++++ | 6 % ~07s
|++++ | 7 % ~07s
|+++++ | 8 % ~07s
|+++++ | 9 % ~06s
|++++++ | 10% ~06s
|++++++ | 11% ~06s
|+++++++ | 12% ~06s
|+++++++ | 13% ~06s
|++++++++ | 14% ~06s
|++++++++ | 15% ~06s
|+++++++++ | 16% ~06s
|+++++++++ | 17% ~06s
|++++++++++ | 18% ~06s
|++++++++++ | 19% ~06s
|+++++++++++ | 20% ~05s
|+++++++++++ | 21% ~05s
|++++++++++++ | 22% ~05s
|++++++++++++ | 23% ~05s
|+++++++++++++ | 24% ~05s
|+++++++++++++ | 26% ~05s
|++++++++++++++ | 27% ~05s
|++++++++++++++ | 28% ~05s
|+++++++++++++++ | 29% ~05s
|+++++++++++++++ | 30% ~05s
|++++++++++++++++ | 31% ~05s
|++++++++++++++++ | 32% ~05s
|+++++++++++++++++ | 33% ~04s
|+++++++++++++++++ | 34% ~04s
|++++++++++++++++++ | 35% ~04s
|++++++++++++++++++ | 36% ~04s
|+++++++++++++++++++ | 37% ~04s
|+++++++++++++++++++ | 38% ~04s
|++++++++++++++++++++ | 39% ~04s
|++++++++++++++++++++ | 40% ~04s
|+++++++++++++++++++++ | 41% ~04s
|+++++++++++++++++++++ | 42% ~04s
|++++++++++++++++++++++ | 43% ~04s
|++++++++++++++++++++++ | 44% ~04s
|+++++++++++++++++++++++ | 45% ~04s
|+++++++++++++++++++++++ | 46% ~04s
|++++++++++++++++++++++++ | 47% ~03s
|++++++++++++++++++++++++ | 48% ~03s
|+++++++++++++++++++++++++ | 49% ~03s
|+++++++++++++++++++++++++ | 50% ~03s
|++++++++++++++++++++++++++ | 51% ~03s
|+++++++++++++++++++++++++++ | 52% ~03s
|+++++++++++++++++++++++++++ | 53% ~03s
|++++++++++++++++++++++++++++ | 54% ~03s
|++++++++++++++++++++++++++++ | 55% ~03s
|+++++++++++++++++++++++++++++ | 56% ~03s
|+++++++++++++++++++++++++++++ | 57% ~03s
|++++++++++++++++++++++++++++++ | 58% ~03s
|++++++++++++++++++++++++++++++ | 59% ~03s
|+++++++++++++++++++++++++++++++ | 60% ~03s
|+++++++++++++++++++++++++++++++ | 61% ~03s
|++++++++++++++++++++++++++++++++ | 62% ~02s
|++++++++++++++++++++++++++++++++ | 63% ~02s
|+++++++++++++++++++++++++++++++++ | 64% ~02s
|+++++++++++++++++++++++++++++++++ | 65% ~02s
|++++++++++++++++++++++++++++++++++ | 66% ~02s
|++++++++++++++++++++++++++++++++++ | 67% ~02s
|+++++++++++++++++++++++++++++++++++ | 68% ~02s
|+++++++++++++++++++++++++++++++++++ | 69% ~02s
|++++++++++++++++++++++++++++++++++++ | 70% ~02s
|++++++++++++++++++++++++++++++++++++ | 71% ~02s
|+++++++++++++++++++++++++++++++++++++ | 72% ~02s
|+++++++++++++++++++++++++++++++++++++ | 73% ~02s
|++++++++++++++++++++++++++++++++++++++ | 74% ~02s
|++++++++++++++++++++++++++++++++++++++ | 76% ~02s
|+++++++++++++++++++++++++++++++++++++++ | 77% ~02s
|+++++++++++++++++++++++++++++++++++++++ | 78% ~01s
|++++++++++++++++++++++++++++++++++++++++ | 79% ~01s
|++++++++++++++++++++++++++++++++++++++++ | 80% ~01s
|+++++++++++++++++++++++++++++++++++++++++ | 81% ~01s
|+++++++++++++++++++++++++++++++++++++++++ | 82% ~01s
|++++++++++++++++++++++++++++++++++++++++++ | 83% ~01s
|++++++++++++++++++++++++++++++++++++++++++ | 84% ~01s
|+++++++++++++++++++++++++++++++++++++++++++ | 85% ~01s
|+++++++++++++++++++++++++++++++++++++++++++ | 86% ~01s
|++++++++++++++++++++++++++++++++++++++++++++ | 87% ~01s
|++++++++++++++++++++++++++++++++++++++++++++ | 88% ~01s
|+++++++++++++++++++++++++++++++++++++++++++++ | 89% ~01s
|+++++++++++++++++++++++++++++++++++++++++++++ | 90% ~01s
|++++++++++++++++++++++++++++++++++++++++++++++ | 91% ~01s
|++++++++++++++++++++++++++++++++++++++++++++++ | 92% ~01s
|+++++++++++++++++++++++++++++++++++++++++++++++ | 93% ~00s
|+++++++++++++++++++++++++++++++++++++++++++++++ | 94% ~00s
|++++++++++++++++++++++++++++++++++++++++++++++++ | 95% ~00s
|++++++++++++++++++++++++++++++++++++++++++++++++ | 96% ~00s
|+++++++++++++++++++++++++++++++++++++++++++++++++ | 97% ~00s
|+++++++++++++++++++++++++++++++++++++++++++++++++ | 98% ~00s
|++++++++++++++++++++++++++++++++++++++++++++++++++| 99% ~00s
|++++++++++++++++++++++++++++++++++++++++++++++++++| 100% elapsed = 07s
| | 0 % ~calculating
|+ | 1 % ~09s
|++ | 2 % ~09s
|++ | 3 % ~08s
|+++ | 4 % ~08s
|+++ | 5 % ~08s
|++++ | 6 % ~08s
|++++ | 7 % ~08s
|+++++ | 9 % ~07s
|+++++ | 10% ~07s
|++++++ | 11% ~07s
|++++++ | 12% ~07s
|+++++++ | 13% ~07s
|+++++++ | 14% ~07s
|++++++++ | 15% ~07s
|++++++++ | 16% ~07s
|+++++++++ | 17% ~07s
|++++++++++ | 18% ~07s
|++++++++++ | 19% ~07s
|+++++++++++ | 20% ~07s
|+++++++++++ | 21% ~07s
|++++++++++++ | 22% ~06s
|++++++++++++ | 23% ~06s
|+++++++++++++ | 24% ~06s
|+++++++++++++ | 26% ~06s
|++++++++++++++ | 27% ~06s
|++++++++++++++ | 28% ~06s
|+++++++++++++++ | 29% ~06s
|+++++++++++++++ | 30% ~06s
|++++++++++++++++ | 31% ~06s
|++++++++++++++++ | 32% ~06s
|+++++++++++++++++ | 33% ~05s
|++++++++++++++++++ | 34% ~05s
|++++++++++++++++++ | 35% ~05s
|+++++++++++++++++++ | 36% ~05s
|+++++++++++++++++++ | 37% ~05s
|++++++++++++++++++++ | 38% ~05s
|++++++++++++++++++++ | 39% ~05s
|+++++++++++++++++++++ | 40% ~05s
|+++++++++++++++++++++ | 41% ~05s
|++++++++++++++++++++++ | 43% ~05s
|++++++++++++++++++++++ | 44% ~05s
|+++++++++++++++++++++++ | 45% ~04s
|+++++++++++++++++++++++ | 46% ~04s
|++++++++++++++++++++++++ | 47% ~04s
|++++++++++++++++++++++++ | 48% ~04s
|+++++++++++++++++++++++++ | 49% ~04s
|+++++++++++++++++++++++++ | 50% ~04s
|++++++++++++++++++++++++++ | 51% ~04s
|+++++++++++++++++++++++++++ | 52% ~04s
|+++++++++++++++++++++++++++ | 53% ~04s
|++++++++++++++++++++++++++++ | 54% ~04s
|++++++++++++++++++++++++++++ | 55% ~04s
|+++++++++++++++++++++++++++++ | 56% ~04s
|+++++++++++++++++++++++++++++ | 57% ~03s
|++++++++++++++++++++++++++++++ | 59% ~03s
|++++++++++++++++++++++++++++++ | 60% ~03s
|+++++++++++++++++++++++++++++++ | 61% ~03s
|+++++++++++++++++++++++++++++++ | 62% ~03s
|++++++++++++++++++++++++++++++++ | 63% ~03s
|++++++++++++++++++++++++++++++++ | 64% ~03s
|+++++++++++++++++++++++++++++++++ | 65% ~03s
|+++++++++++++++++++++++++++++++++ | 66% ~03s
|++++++++++++++++++++++++++++++++++ | 67% ~03s
|+++++++++++++++++++++++++++++++++++ | 68% ~03s
|+++++++++++++++++++++++++++++++++++ | 69% ~03s
|++++++++++++++++++++++++++++++++++++ | 70% ~02s
|++++++++++++++++++++++++++++++++++++ | 71% ~02s
|+++++++++++++++++++++++++++++++++++++ | 72% ~02s
|+++++++++++++++++++++++++++++++++++++ | 73% ~02s
|++++++++++++++++++++++++++++++++++++++ | 74% ~02s
|++++++++++++++++++++++++++++++++++++++ | 76% ~02s
|+++++++++++++++++++++++++++++++++++++++ | 77% ~02s
|+++++++++++++++++++++++++++++++++++++++ | 78% ~02s
|++++++++++++++++++++++++++++++++++++++++ | 79% ~02s
|++++++++++++++++++++++++++++++++++++++++ | 80% ~02s
|+++++++++++++++++++++++++++++++++++++++++ | 81% ~02s
|+++++++++++++++++++++++++++++++++++++++++ | 82% ~02s
|++++++++++++++++++++++++++++++++++++++++++ | 83% ~01s
|+++++++++++++++++++++++++++++++++++++++++++ | 84% ~01s
|+++++++++++++++++++++++++++++++++++++++++++ | 85% ~01s
|++++++++++++++++++++++++++++++++++++++++++++ | 86% ~01s
|++++++++++++++++++++++++++++++++++++++++++++ | 87% ~01s
|+++++++++++++++++++++++++++++++++++++++++++++ | 88% ~01s
|+++++++++++++++++++++++++++++++++++++++++++++ | 89% ~01s
|++++++++++++++++++++++++++++++++++++++++++++++ | 90% ~01s
|++++++++++++++++++++++++++++++++++++++++++++++ | 91% ~01s
|+++++++++++++++++++++++++++++++++++++++++++++++ | 93% ~01s
|+++++++++++++++++++++++++++++++++++++++++++++++ | 94% ~01s
|++++++++++++++++++++++++++++++++++++++++++++++++ | 95% ~00s
|++++++++++++++++++++++++++++++++++++++++++++++++ | 96% ~00s
|+++++++++++++++++++++++++++++++++++++++++++++++++ | 97% ~00s
|+++++++++++++++++++++++++++++++++++++++++++++++++ | 98% ~00s
|++++++++++++++++++++++++++++++++++++++++++++++++++| 99% ~00s
|++++++++++++++++++++++++++++++++++++++++++++++++++| 100% elapsed = 08s
| | 0 % ~calculating
|+ | 1 % ~06s
|+ | 2 % ~06s
|++ | 3 % ~06s
|++ | 4 % ~06s
|+++ | 5 % ~06s
|+++ | 6 % ~06s
|++++ | 7 % ~06s
|++++ | 8 % ~05s
|+++++ | 9 % ~05s
|+++++ | 10% ~05s
|++++++ | 11% ~05s
|++++++ | 12% ~05s
|+++++++ | 13% ~05s
|+++++++ | 14% ~05s
|++++++++ | 15% ~05s
|++++++++ | 16% ~05s
|+++++++++ | 17% ~05s
|+++++++++ | 18% ~05s
|++++++++++ | 19% ~05s
|++++++++++ | 20% ~05s
|+++++++++++ | 21% ~05s
|+++++++++++ | 22% ~05s
|++++++++++++ | 23% ~05s
|++++++++++++ | 24% ~04s
|+++++++++++++ | 25% ~04s
|+++++++++++++ | 26% ~04s
|++++++++++++++ | 27% ~04s
|++++++++++++++ | 28% ~04s
|+++++++++++++++ | 29% ~04s
|+++++++++++++++ | 30% ~04s
|++++++++++++++++ | 31% ~04s
|++++++++++++++++ | 32% ~04s
|+++++++++++++++++ | 33% ~04s
|+++++++++++++++++ | 34% ~04s
|++++++++++++++++++ | 35% ~04s
|++++++++++++++++++ | 36% ~04s
|+++++++++++++++++++ | 37% ~04s
|+++++++++++++++++++ | 38% ~04s
|++++++++++++++++++++ | 39% ~04s
|++++++++++++++++++++ | 40% ~04s
|+++++++++++++++++++++ | 41% ~03s
|+++++++++++++++++++++ | 42% ~03s
|++++++++++++++++++++++ | 43% ~03s
|++++++++++++++++++++++ | 44% ~03s
|+++++++++++++++++++++++ | 45% ~03s
|+++++++++++++++++++++++ | 46% ~03s
|++++++++++++++++++++++++ | 47% ~03s
|++++++++++++++++++++++++ | 48% ~03s
|+++++++++++++++++++++++++ | 49% ~03s
|+++++++++++++++++++++++++ | 50% ~03s
|++++++++++++++++++++++++++ | 51% ~03s
|++++++++++++++++++++++++++ | 52% ~03s
|+++++++++++++++++++++++++++ | 53% ~03s
|+++++++++++++++++++++++++++ | 54% ~03s
|++++++++++++++++++++++++++++ | 55% ~03s
|++++++++++++++++++++++++++++ | 56% ~03s
|+++++++++++++++++++++++++++++ | 57% ~03s
|+++++++++++++++++++++++++++++ | 58% ~03s
|++++++++++++++++++++++++++++++ | 59% ~02s
|++++++++++++++++++++++++++++++ | 60% ~02s
|+++++++++++++++++++++++++++++++ | 61% ~02s
|+++++++++++++++++++++++++++++++ | 62% ~02s
|++++++++++++++++++++++++++++++++ | 63% ~02s
|++++++++++++++++++++++++++++++++ | 64% ~02s
|+++++++++++++++++++++++++++++++++ | 65% ~02s
|+++++++++++++++++++++++++++++++++ | 66% ~02s
|++++++++++++++++++++++++++++++++++ | 67% ~02s
|++++++++++++++++++++++++++++++++++ | 68% ~02s
|+++++++++++++++++++++++++++++++++++ | 69% ~02s
|+++++++++++++++++++++++++++++++++++ | 70% ~02s
|++++++++++++++++++++++++++++++++++++ | 71% ~02s
|++++++++++++++++++++++++++++++++++++ | 72% ~02s
|+++++++++++++++++++++++++++++++++++++ | 73% ~02s
|+++++++++++++++++++++++++++++++++++++ | 74% ~02s
|++++++++++++++++++++++++++++++++++++++ | 75% ~02s
|++++++++++++++++++++++++++++++++++++++ | 76% ~01s
|+++++++++++++++++++++++++++++++++++++++ | 77% ~01s
|+++++++++++++++++++++++++++++++++++++++ | 78% ~01s
|++++++++++++++++++++++++++++++++++++++++ | 79% ~01s
|++++++++++++++++++++++++++++++++++++++++ | 80% ~01s
|+++++++++++++++++++++++++++++++++++++++++ | 81% ~01s
|+++++++++++++++++++++++++++++++++++++++++ | 82% ~01s
|++++++++++++++++++++++++++++++++++++++++++ | 83% ~01s
|++++++++++++++++++++++++++++++++++++++++++ | 84% ~01s
|+++++++++++++++++++++++++++++++++++++++++++ | 85% ~01s
|+++++++++++++++++++++++++++++++++++++++++++ | 86% ~01s
|++++++++++++++++++++++++++++++++++++++++++++ | 87% ~01s
|++++++++++++++++++++++++++++++++++++++++++++ | 88% ~01s
|+++++++++++++++++++++++++++++++++++++++++++++ | 89% ~01s
|+++++++++++++++++++++++++++++++++++++++++++++ | 90% ~01s
|++++++++++++++++++++++++++++++++++++++++++++++ | 91% ~01s
|++++++++++++++++++++++++++++++++++++++++++++++ | 92% ~00s
|+++++++++++++++++++++++++++++++++++++++++++++++ | 93% ~00s
|+++++++++++++++++++++++++++++++++++++++++++++++ | 94% ~00s
|++++++++++++++++++++++++++++++++++++++++++++++++ | 95% ~00s
|++++++++++++++++++++++++++++++++++++++++++++++++ | 96% ~00s
|+++++++++++++++++++++++++++++++++++++++++++++++++ | 97% ~00s
|+++++++++++++++++++++++++++++++++++++++++++++++++ | 98% ~00s
|++++++++++++++++++++++++++++++++++++++++++++++++++| 99% ~00s
|++++++++++++++++++++++++++++++++++++++++++++++++++| 100% elapsed = 06s
subtiss.markers %>% group_by(cluster) %>% top_n(3)
Selecting by gene
Check expression of genes of interset.
genes_to_check = c('Lgr5','Fabp5','Marcks','Zfp830','Slc6a8')
FeaturePlot(subtiss, genes_to_check, pt.size = 1)
Dotplots let you see the intensity of exppression and the fraction of cells expressing for each of your genes of interest.
# To change the y-axis to show raw counts, add use.raw = T.
DotPlot(subtiss, genes_to_check, plot.legend = T)
How big are the clusters?
table(subtiss@ident)
0 1 2 3
62 47 39 36
Color by metadata, like plate barcode, to check for batch effects.
TSNEPlot(object = subtiss, do.return = TRUE, group.by = "plate.barcode")
Print a table showing the count of cells in each identity category from each plate.
table(as.character(subtiss@ident), as.character(subtiss@meta.data$plate.barcode))
B001717 B002775 MAA000545 MAA000752 MAA000801 MAA000922
0 8 11 7 12 19 5
1 1 1 16 8 16 5
2 6 2 5 4 21 1
3 27 4 0 1 3 1
When you save the annotated tissue, please give it a name.
filename = here('00_data_ingest', '04_tissue_robj_generated',
paste0("facs", tissue_of_interest, "_seurat_tiss.Robj"))
print(filename)
[1] "/Users/olgabot/code/tabula-muris/00_data_ingest/04_tissue_robj_generated/facsKidney_seurat_tiss.Robj"
save(tiss, file=filename)
# To reload a saved object
# filename = here('00_data_ingest', '04_tissue_robj_generated',
# paste0("facs", tissue_of_interest, "_seurat_tiss.Robj"))
# load(file=filename)
So that Biohub can easily combine all your cell_ontology_classs, please export them as a simple csv.
head(tiss@meta.data)
filename = here('00_data_ingest', '03_tissue_annotation_csv',
paste0(tissue_of_interest, "_facs_annotation.csv"))
write.csv(FetchData(tiss, c('plate.barcode','cell_ontology_class','cell_ontology_id', 'free_annotation', 'tSNE_1', 'tSNE_2')), file=filename)